tree grammar XHTML2CSVTree;

options {
	tokenVocab=XHTML2CSV;
	ASTLabelType=CommonTree;
}

@members {
				// variables and methods to be included in the java file generated
}

/*------------------------------------------------------------------
 * TREE RULES
 *------------------------------------------------------------------*/

// example

tableau returns [String csv] : ^(TABLEAU lignes);

lignes returns [String csv] : l1=ligne l2=lignes2 { $csv = $l1.csv + "\n" + $l2.csv ;};

lignes2 returns [String csv] : l1=ligne l2=lignes2 { $csv = $l1.csv + "\n" + $l2.csv ;} | { $csv = "" ;};

ligne returns [String csv] : ^(LIGNE cellules);

cellules returns [String csv] : c1=cellule c2=cellules { $csv = "\"" + $c1.csv + ", " + $c2.csv ;} | c1=cellule { $csv = "\"" + $c1.csv ;};

cellule returns [String csv] : ^(CELLULE s=CHAINE){ $csv = $s.text; };
